package com.xnx3.wangmarket.plugin.offlineWeixinNotification.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xnx3.StringUtil;
import com.xnx3.j2ee.entity.SmsLog;
import com.xnx3.j2ee.entity.User;
import com.xnx3.j2ee.pluginManage.controller.BasePluginController;
import com.xnx3.j2ee.service.SmsService;
import com.xnx3.j2ee.service.SqlService;
import com.xnx3.j2ee.service.UserService;
import com.xnx3.j2ee.util.ActionLogUtil;
import com.xnx3.j2ee.vo.BaseVO;
import com.xnx3.kefu.admin.util.SessionUtil;
import com.xnx3.kefu.core.service.KefuService;
import com.xnx3.kefu.core.vo.KefuVO;
import com.xnx3.wangmarket.plugin.offlineWeixinNotification.Global;
import com.xnx3.wangmarket.plugin.offlineWeixinNotification.entity.OfflineWeixinNotification;

/**
 * 离线通知
 * @author 管雷鸣
 */
@Controller(value="LeimingyunOfflineWeixinNotificationKefuController")
@RequestMapping("/plugin/offlineWeixinNotification/admin/")
public class OfflineWeixinNotificationKefuPluginController extends BasePluginController{
	@Resource
	private SqlService sqlService;
	@Resource
	private UserService userService;
	@Resource
	private SmsService smsService;
	@Resource
	private KefuService kefuService;
	
	
	/**
	 * 进入离线通知设置页面，也就是入口的首页
	 */
	@RequestMapping(value="index.do")
	public String index(HttpServletRequest request, Model model){
		if(getUser() == null){
			//需要登录
			return error(model, "请登陆后使用");
		}
		
		//判断是否启用
		if(Global.weixin == null) {
			return error(model, "尚未启用离线微信自动通知功能");
		}
		
		ActionLogUtil.insert(request, "offlineWeixinNotification plugin 打开客服后台设置页面");
		return "plugin/offlineWeixinNotification/admin/index";
	}
	
}
